﻿using System;

namespace Dotnet.Utils.Utility
{
    /// <summary>
    /// 无效值
    /// </summary>
    public static class NoneValue
    {
        public const int NaInt = Int32.MinValue;

        public static bool IsNaIntString(string intString)
        {
            if (intString == NaInt.ToString())
                return true;
            return false;
        }

        public static bool IsNaInt(object obj)
        {
            if (obj is int)
            {
                return ((int)obj) == NaInt;
            }
            return false;
        }

        public const int NaDecimal = Int32.MinValue;

        public static bool IsNaDecimalString(string decimalString)
        {
            if (decimalString == NaDecimal.ToString())
                return true;
            return false;
        }

        public static bool IsNaDecimal(object obj)
        {
            if (obj is decimal)
            {
                return ((decimal)obj) == NaDecimal;
            }
            return false;
        }

        public static readonly DateTime NaDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);

        public static bool IsNaDateTimeString(string dateString, string format = "yyyy-MM-dd HH:mm:ss")
        {
            if (dateString == NaDateTime.ToString())
                return true;
            return false;
        }

        public static bool IsNaDateTime(object obj)
        {
            if (obj is DateTime)
            {
                return ((DateTime)obj) == NaDateTime;
            }
            return false;
        }
    }
}